require 'open3'

system("dir")
d = `path`
puts d
# 通信的是一个程序而不是文件
d = open("|path","w+")
d.puts "Hello to cat"
d.gets
d.close

stdin, stdout, stderr = Open3.popen3("path")
stdin.puts("Hi.\nBye")
stdout.gets
stdout.gets


